<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<?php
    echo "hello<br>";
    var_dump($_POST);
    echo "<br>";
    var_dump($_GET);
    echo "<br>";
    $uname = $_POST["uname"];
    $pwd = $_POST["pwd"];
    $email = $_POST["email"];
    
    
    echo "<br>";


    //1.连接数据库
    $link=mysqli_connect("localhost","root","");//链接数据库
    mysqli_select_db($link, "nhcar");//选择数据库
    mysqli_set_charset($link, "utf8");//设置数据库连接资源字符集

    
    $sql="INSERT INTO users(uname,upwd,uemail)VALUES('$uname','$pwd','$email');";
    echo "$sql<br>";
    $result= mysqli_query($link, $sql);
    var_dump($result);
    
    if($result){
            //成功跳转到首页
            // echo "<script> location.href='./Home-Index-index.php' </script>";
            header("Location:index.php");
    }else{
            //失败跳转到注册页
            // echo "<script> location.href='Home-User-register.php' </script>";
            header("Location:register.php");
    }
?>
</body>
</html>